﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.Common;

namespace Golf.WebUI.AdminShow.OrderManagement
{
    public partial class Golf_AdminMessageAdd : Golf.WebUI.App_code.ValidateLogin
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            if (!PageValidate.IsNumber(txtOrderId.Text))
            {
                strErr += "订单ID Golf_Order格式错误！\\n";
            }
            if (this.txtOrderNumber.Text.Trim().Length == 0)
            {
                strErr += "订单号 Golf_Order不能为空！\\n";
            }
            if (this.txtOperatorMessage.Text.Trim().Length == 0)
            {
                strErr += "操作留言信息不能为空！\\n";
            }
            if (!PageValidate.IsNumber(txtAdminId.Text))
            {
                strErr += "操作管理人id Golf_Ad格式错误！\\n";
            }
            if (!PageValidate.IsDateTime(txtAddTime.Text))
            {
                strErr += "操作时间格式错误！\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int OrderId = int.Parse(this.txtOrderId.Text);
            string OrderNumber = this.txtOrderNumber.Text;
            string OperatorMessage = this.txtOperatorMessage.Text;
            int AdminId = int.Parse(this.txtAdminId.Text);
            DateTime AddTime = DateTime.Parse(this.txtAddTime.Text);
            bool IsShow = this.chkIsShow.Checked;

            Golf.Model.Golf_AdminMessage model = new Golf.Model.Golf_AdminMessage();
            model.OrderId = OrderId;
            model.OrderNumber = OrderNumber;
            model.OperatorMessage = OperatorMessage;
            model.AdminId = AdminId;
            model.AddTime = AddTime;
            model.IsShow = IsShow;

            Golf.BLL.Golf_AdminMessage bll = new Golf.BLL.Golf_AdminMessage();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "add.aspx");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}